Skip to content

fix(ci): restore torch E2E coverage in unit-vs-E2E summary - #942

Merged
wenxie-amd merged 8 commits into
mainfrom
fix/ci-torch-e2e-coverage-combine
Aug 21, 2026
Merged

fix(ci): restore torch E2E coverage in unit-vs-E2E summary#942
wenxie-amd merged 8 commits into
mainfrom
fix/ci-torch-e2e-coverage-combine

Conversation

@WangLingxun

@WangLingxun WangLingxun commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix torch E2E coverage missing from the CI Unit vs Unit+E2E summary after PR Update turbo flydsl sparse attn #898 moved the combine step into docker exec without passing COVERAGE_FILE.
  • Rename unit snapshot from .coverage.unit to .coverage_unit so it is not treated as a .coverage.* parallel shard.
  • Explicitly merge .coverage_e2e.* shards before line-merging with unit data.
  • Only run the E2E-shard combine when shards actually exist, and require coverage_combined.json to be non-empty, so a failed merge fails the step instead of silently succeeding with no file.
  • Enable --cov-branch for the unit lane only. E2E stays line-only: turning on branch = true in .coveragerc_e2e made the trainer subprocess chain crash (SIGABRT across all 8 ranks in test_memory_benchmark) once coverage's branch trace was active during real GPU training — caught by this PR's own CI run, reverted before merge.
  • coverage combine refuses to mix branch data with statement-only data (Can't combine branch coverage data with statement data), so .coverage_unit (now branch-aware) can no longer be merged with .coverage_e2e directly. Project unit's data down to its executed-line set into a throwaway file before merging — coverage_unit.json (exported earlier from the original branch-aware data) still carries real branch info for external tooling, and coverage_combined.json stays an honest line-only union of unit + E2E. Verified locally end-to-end.
  • Caption the "including all modules" summary line to note Unit also counts branches while E2E is lines only, since coverage.py's own percent_covered now folds branches into the unit side of that number.
  • Refresh the stale backends/megatron note in coverage_summary.py: CI E2E now runs 15+ configs/PR, not 1-2.

PR #898 moved the torch coverage combine step into docker exec without
passing COVERAGE_FILE, so the first combine merged .coverage.unit as a
parallel shard instead of .coverage_e2e.*. Rename the unit snapshot to
.coverage_unit, merge E2E shards explicitly, and warn when
coverage_combined.json is missing.
@WangLingxun
WangLingxun marked this pull request as ready for review July 31, 2026 06:39
- Add branch = true / --cov-branch to unit and E2E .coveragerc so a
  covered function means both branch arms ran, not just one line.
- Only combine E2E shards when present, and require
  coverage_combined.json to be non-empty, so a failed merge shows red
  instead of silently succeeding with no file.
- Caption the "including all modules" summary line as lines+branches,
  since coverage.py's percent_covered now folds branches in.
- Refresh the stale backends/megatron note: CI E2E now runs 15+
  configs/PR, not 1-2.
test_memory_benchmark SIGABRT'd across all 8 ranks in the last run:
enabling coverage's branch trace while torchrun's real GPU training
subprocesses run is not safe. Unit (a plain pytest process) keeps
--cov-branch; only the E2E lanes drop back to line-only coverage.
coverage combine refuses to mix branch data with statement data
("Can't combine branch coverage data with statement data"), so
.coverage_unit (recorded with --cov-branch) can no longer be merged
directly with .coverage_e2e (line-only). Project unit's data down to
its executed-line set into a throwaway file first -- coverage_unit.json
(exported earlier from the original branch-aware data) is unaffected,
and coverage_combined.json is unchanged: still an honest line-only
union of unit + E2E.

Verified locally end-to-end: standalone coverage_unit.json keeps
branch_coverage=true and real missing_branches, while
coverage_combined.json stays branch_coverage=false and correctly
unions both lanes' executed lines.
@wenxie-amd
wenxie-amd merged commit 18038a1 into main Aug 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants